class Enemy extends Spirit {
  constructor(x = 0, y = 0) {
    super('img/enemy.png')
    this.speed = 3
    this.x = x
    this.y = y
  }
  update() {
    this.y += this.speed

    if (this.y > 600) {
      this.y = utils.random(-3000, 200)
    }

    this.checkHit()
  }

  checkHit() {
    const player = this._scene.player
    if (utils.intersect(this, player)) {
      this._scene.game.over = true
    }
  }
}